<template>
  <view :style="pubSty">
    <dis-head :docInf="objInfo" v-if="flag" />
    <dis-body :docInf="objInfo" v-if="flag" />
  </view>
</template>

<script>
import { mixins } from '../../common/mixins.js'
import DisHead from '../../components/discover-head/discover-head.vue'
import DisBody from '../../components/discover-body/discover-body.vue'


export default {
  components: {
    DisHead, DisBody
  },
	mixins: [mixins],
  data () {
    return {
      pubSty: '',
			objInfo: '',
			flag: false
    }
  },
  async onShow() {
		let openid = uni.getStorageSync('openid') //获取保存的身份信息
		if(!openid) {
			this.objInfo = ''
			this.flag = true
		} else if(!this.objInfo) {
			let code = JSON.stringify("'" + openid + "'")
			const { data: res } = await this.$http.get(`/index?phone=${code}&state=1`)
			const { data: res2 } = await this.$http.get(`/docInf?phone=${code}`)
			this.objInfo = Object.assign(res.ress[0], res2[0])
			this.flag = true
		}
  },
}
</script>

<style lang="scss" scoped>
  .jumpai {
    color: var(--backgroundColor);
  }
</style>